#!/bin/sh
#chmod 777 本地校验.sh 添加可执行命令

echo "传入podspec名称，不需要.podspec"

read podspecName

echo "传入参数(0:本地校验;1:远程校验;2:上传发布):"

#读取参数
read paramter

if [[ $paramter -eq 0 ]]; then
	#本地校验
	pod lib lint ${podspecName}.podspec --verbose --allow-warnings --use-libraries --skip-import-validation --sources='git@gitee.com:lz156/QYMSpecs.git,https://github.com/CocoaPods/Specs.git,https://gitee.com/zhencanbing/ZCBSpecs.git',"https://github.com/aliyun/aliyun-specs.git";

elif [[ $paramter -eq 1 ]]; then
	#远程校验
	pod spec lint ${podspecName}.podspec --verbose --allow-warnings --use-libraries --skip-import-validation --sources='git@gitee.com:lz156/QYMSpecs.git,https://github.com/CocoaPods/Specs.git,https://gitee.com/zhencanbing/ZCBSpecs.git',"https://github.com/aliyun/aliyun-specs.git";

elif [[ $paramter -eq 2 ]]; then

    echo "specs索引仓库名称；如：QYMSpecs"
    read specsName
    
	#上传发布
	pod repo push ${specsName} ${podspecName}.podspec --verbose --allow-warnings --use-libraries --skip-import-validation --sources='git@gitee.com:lz156/QYMSpecs.git,https://github.com/CocoaPods/Specs.git,https://gitee.com/zhencanbing/ZCBSpecs.git',"https://github.com/aliyun/aliyun-specs.git";
else
	echo "输入参数错误"
fi


exit;
